cmake_minimum_required(VERSION 3.10)

project(demo01)

set(SRCS)
set(INCS)

macro(AddSub dir_name)
    add_subdirectory(${dir_name})
    # message(STATUS "Add subdirectory: ${dir_name}")
    get_property(${dir_name}_SRCS GLOBAL PROPERTY ${dir_name}_srcs)
    list(APPEND SRCS ${${dir_name}_SRCS})
    get_property(${dir_name}_INCS GLOBAL PROPERTY ${dir_name}_sub_dirs)
    list(APPEND INCS ${${dir_name}_INCS})
endmacro(AddSub dir_name)

AddSub(add)

include_directories(${INCS})
message(STATUS "Add include directories: ${INCS}")

list(APPEND SRCS main.cpp)
message(STATUS "Add source files: ${SRCS}")

add_executable(demo01 ${SRCS})
